<?

class Layout
{
    private static $instance;
    
    private function __construct() {}
    
    public static function getInstance()
    {
        if (self::$instance === NULL)
        {
            self::$instance = new self;
        }
        return self::$instance;
    }
    
    /**
    * Zobrazi sablonu hlavicky
    * @access public
    * @author Adam Motvicka
    */
    public static function showHeader($tables)
    {
        include ("./templates/header.php");
    }
    
    /**
    * Zobrazi sablonu paticky
    * @access public
    * @author Adam Motvicka
    */
    public static function showFooter()
    {
        include ("./templates/footer.php");
    }
    
    /**
    * Zobrazi sablonu hlavicky iframu
    * @access public
    * @author Adam Motvicka
    */
    public static function showIframeHeader($tables)
    {
        include ("./templates/iframe.header.php");
    }
    
    /**
    * Zobrazi sablonu paticky iframu
    * @access public
    * @author Adam Motvicka
    */
    public static function showIframeFooter()
    {
        include ("./templates/iframe.footer.php");
    }
    
    /**
    * Zobrazi sablonu pro seznam tabulek
    * @param array $tables Seznam tabulek
    * @access public
    * @author Adam Motvicka
    */
    public static function printTablesList($tables)
    {
        include ("./templates/tables_list.php");
    }
    
    /**
    * Zobrazi sablonu pro obsah tabulky
    * @param array $data Obsah tabulky
    * @param array $describe Describe tabulky
    * @access public
    * @author Adam Motvicka
    */
    public static function printTable($data, $describe)
    {
        include ("./templates/table.php");
    }
    
    /**
    * Zobrazi oddelovac stranek
    * @param array $divider Pole Divider z objektu DBmister
    * @access public
    * @author Adam Motvicka
    */
    public static function printDivider($divider)
    {
        include ("./templates/divider.php");
    }
    
    /**
    * Zobrazi sablonu pro nastaveni tabulky
    * @param array $describe DESRIBE tabulky
    * @access public
    * @author Adam Motvicka
    */
    public static function printTableSettings($describe, $settings)
    {
        include ("./templates/table_settings.php");
    }
    
    /**
    * Zobrazi hlaseni z iframu a zavre ho
    * @param array $msg Zprava
    * @access public
    * @author Adam Motvicka
    */
    public static function iframeAlertAndClose($msg)
    {
        echo "<script>alert('{$msg}'); parent.parent.GB_CURRENT.hide(); parent.parent.location.reload();</script>";
        exit;
    }
    
}

?>
